//
//  WZPThemeBottom.m
//  WZPItem
//
//  Created by 王王喆平 on 16/7/17.
//  Copyright © 2016年 UI. All rights reserved.
//

#import "WZPThemeBottom.h"
#import "WZPThemeItem.h"
@interface WZPThemeBottom()
@property (weak, nonatomic) IBOutlet UIButton *dingBtn;
@property (weak, nonatomic) IBOutlet UIButton *caiBtn;
@property (weak, nonatomic) IBOutlet UIButton *repostBtn;
@property (weak, nonatomic) IBOutlet UIButton *commentBtn;

@end

@implementation WZPThemeBottom
-(void)setItem:(WZPThemeItem *)item{
    [super setItem:item];
    
    [self setupBottomTitle:_dingBtn count:item.ding title:@"顶"];
    [self setupBottomTitle:_caiBtn count:item.cai title:@"踩"];
    [self setupBottomTitle:_repostBtn count:item.repost title:@"转发"];
    [self setupBottomTitle:_commentBtn count:item.comment title:@"评论"];



}
-(void)setupBottomTitle:(UIButton *)buttn count:(NSInteger)count title:(NSString *) title{
    if (count > 10000.0) {
        CGFloat value = count / 10000.0;
        title = [NSString stringWithFormat:@"%.2f万人",value];
        title = [title stringByReplacingOccurrencesOfString:@"0" withString:@""];
    }else if (count > 0){

        title = [NSString stringWithFormat:@"%1ld",count];

    }
    [buttn setTitle:title forState:UIControlStateNormal];

}


@end
